import { defineStore } from 'pinia'
import type { Ref } from 'vue'

interface MenuStoreState {
  current: Ref<string[]>
  set_current: (key: string) => void
}
export const useMenuStore = defineStore(
  'menuStore',
  (): MenuStoreState => {
    const current = ref<string[]>(['home'])
    function set_current(key: string) {
      current.value.length = 0
      current.value.push(key)
    }
    return {
      current,
      set_current
    }
  },
  {
    persist: true
  }
)
